//
//  SettingsViewController.h
//  Memento 3.0
//
//  Created by Chris Mdadocks on 10-07-31.
//  Copyright 2010 Team Memento. All rights reserved.
//
//  Description: This is the view controller for the settings panel in Memento.  It is used to configure access to
//  Memento Server, toggle the sort mode, and delete the current memory.
//
//  10-08-03: Add support for deleting current memory  (C. Maddocks)
//  10-07-31: Initial creation (C. Maddocks)


#import <UIKit/UIKit.h>
#import "PhotoCollection.h"


#define kServerURLTag 0
#define kServerUsernameTag 1
#define kServerPasswordTag 2

#define kSortKey @"sort_method"
#define kServerURLKey @"serverURL"
#define kServerUsernameKey @"serverUsername"
#define kServerPasswordKey @"serverPassword"

#define kActionSheetDelete	10
#define kActionSheetRestore 20


@interface SettingsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, UIActionSheetDelegate> {
	PhotoCollection *photoCollection;
	
	int oldSortMethod;
	int sortMethod;
	
	IBOutlet UITableView *tableView;
	IBOutlet UIProgressView *progressView;
	
	NSString *serverURL;
	NSString *serverUsername;
	NSString *serverPassword;
	
	UITextField *textFieldBeingEdited;
	NSIndexPath *lastIndexPath;
}
@property (nonatomic, retain) PhotoCollection *photoCollection;
@property (nonatomic, assign) int sortMethod;
@property (nonatomic, retain) NSString *serverURL;
@property (nonatomic, retain) NSString *serverUsername;
@property (nonatomic, retain) NSString *serverPassword;
@property (nonatomic, retain) UITextField *textFieldBeingEdited;

- (IBAction)dismiss;
- (IBAction)backupToServer;
- (IBAction)retrieveFromServer;
- (IBAction)doRetrieveFromServer;
- (IBAction)deleteCurrentMemory;

- (void)keyboardWillShow:(NSNotification *)aNotification;
- (void)keyboardWillHide:(NSNotification *)aNotification;
- (void)refreshSettings;
- (id)initWithPhotoCollection:(PhotoCollection *)aPhotoCollection;


@end
